package com.whiteape.book.ui.fragment;

import android.content.Intent;
import android.os.Build;
import android.widget.TextView;

import androidx.appcompat.widget.SearchView;
import androidx.core.app.ActivityOptionsCompat;

import com.whiteape.book.ui.activity.SearchActivity;
import com.whiteape.book.ui.base.BaseFragment;

import butterknife.BindView;
import com.whiteape.book.R;

public class BigSearchFragment extends BaseFragment {
    @BindView(R.id.sv_bigsearch)
    TextView searchView;

    @Override
    protected int getContentId() {
        return R.layout.fragment_bigsearch;
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        searchView.setOnClickListener((v -> {
            if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), searchView, "search");
                startActivity(new Intent(getActivity(), SearchActivity.class), optionsCompat.toBundle());
            }else{
                startActivity(new Intent(getActivity(), SearchActivity.class));
            }
        }));
    }
}
